package com.example.zhunongzonghe.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.example.zhunongzonghe.beans.ZnPostLikeBean;
import com.example.zhunongzonghe.entity.ZnPostLike;

/**
* @author 蔡某人
* @description 针对表【zn_post_like】的数据库操作Service
* @createDate 2024-04-03 19:16:29
*/

public interface ZnPostLikeService extends IService<ZnPostLike> {

    /**
     * 用户点赞帖子
     * @param znPostLikeBean
     * @return
     */
    void addLike(ZnPostLikeBean znPostLikeBean,String userName);

    /**
     * 帖子是否被点赞
     * @param postId
     * @param userId
     * @return
     */
    Boolean isLiked(Integer postId,Integer userId);

    /**
     * 获取当前帖子点赞数量
     * @param postId
     * @return
     */
    Integer likeCounts(Integer postId);

    /**
     * redis同步点赞数据到MySql数据库
     */
    void syncPostLiked();
}
